SQL

 

Description

SQL is used to retrieve the results of a query. If the results have more than one column, only the first column of the first row that is fetched. The SQL query can have dynamic items within its construct.  These items take the form of [VariableName].  In this case, VariableName can also include PolicyGUID and SegmentGUID, apart from elements that have appeared before this element.

 

SQL Element/Attribute Table

TYPE=SQL

Element

Attributes

Attribute Value

Element Value

<MathVariable>

TYPE

SQL

SELECT statement.

LOG

Yes:  the result is stored in AsActivityMath table to be used by other rules.

No:  result is not stored.

 

DEFAULT

Must be defined when the datatype of the SQL is integer or decimal.

Best practice is to make your default value a value that will indicate you did not retrieve as expected.  Useful for debugging.

 

XML Example

<MathVariable VARIABLENAME="RoleGUID" TYPE="SQL" DATATYPE="TEXT">SELECT AsRole.RoleGUID FROM AsRole</MathVariable>